import type { User } from '@jari-ace/app-bolts';

import type { RouteRecordStringComponent } from '@vben/types';

import { createAxios } from '@jari-ace/app-bolts';

const SERVICE_BASE_URL = '/ace-app-service';

const axios = createAxios();

export interface Result<T = any> {
  code: number;
  data: T;
  error: null | string;
  message: string;
}

export const getUserAuthenticated = () =>
  axios.get<User>(`${SERVICE_BASE_URL}/users/authenticated`);

export const getMenu = () =>
  axios.get<Result<RouteRecordStringComponent[]>>(
    `/api/menu/all`,
    {},
    {
      baseURL: 'http://localhost:5320',
    },
  );
